import request from '@/utils/request'
const path = 'http://39.108.248.115:9000'
const api = {
    roletypes: path + '/base/roletypes',
    dicts: path + '/base/sysDicts',
    relationShip: path + '/base/partyRelationshipTypes'
}
/*
    当事人关系类型
*/
// 获取当事人关系类型分页查询
export function getPartyTypes (parameter) {
    const par = '?pageNum=' + parameter.current + '&pageSize=' + parameter.pageSize +
        '&name=' + parameter.name + '&fromRoleTypeId=' + parameter.fromRoleTypeId +
        '&toRoleTypeId=' + parameter.toRoleTypeId + '&description=' + parameter.description
    return request({
        url: api.relationShip + par,
        method: 'get'
    })
}
// 新增当事人关系类型
export function addPartyTypes (parameter) {
    return request({
        url: api.relationShip,
        method: 'post',
        data: parameter
    })
}
// 获取当事人关系类型详情
export function detailPartyTypes (Id) {
    return request({
        url: api.relationShip + '/' + Id,
        method: 'get'
    })
}

/*
    字典
*/
// 获取字典分页模糊查询
export function getDicts (parameter) {
    const par = '?pageNum=' + parameter.current + '&pageSize=' + parameter.pageSize +
        '&dictName=' + parameter.dictName + '&dictCode=' + parameter.dictCode
    return request({
        url: api.dicts + par,
        method: 'get'
    })
}
// 新增字典
export function addDicts (parameter) {
    return request({
        url: api.dicts,
        method: 'post',
        data: parameter
    })
}
// 获取字典详情
export function detailDicts (dictId) {
    return request({
        url: api.dicts + '/' + dictId,
        method: 'get'
    })
}
// 删除字典
export function deleteDicts (dictId) {
    return request({
        url: api.dicts + '/' + dictId,
        method: 'delete'
    })
}
// 修改字典
export function editDicts (parameter) {
    return request({
        url: api.dicts + '/' + parameter.dictId,
        method: 'put',
        data: parameter
    })
}

// 获取指定字典数据
export function getAppointDicts (key) {
    const par = `?pageNum=1&pageSize=6&dictName=&dictCode=${key}`
    return request({
        url: api.dicts + par,
        method: 'get'
    })
}
/*
    角色类型
*/
// 角色类型分页模糊查询
export function getRoleTypes (parameter) {
    const par = '?pageNum=' + parameter.current + '&pageSize=' + parameter.pageSize +
        '&name=' + parameter.name + '&description=' + parameter.description
    return request({
        url: api.roletypes + par,
        method: 'get'
    })
}

// 添加角色类型
export function addRoleTypes (parameter) {
    return request({
        url: api.roletypes,
        method: 'post',
        data: parameter
    })
}

// 获取角色类型的详细信息
export function detailRoleTypes (roleTypeId) {
    return request({
        url: api.roletypes + '/' + roleTypeId,
        method: 'get'
    })
}
